package com.shiyi;

import sun.awt.windows.WPrinterJob;
import util.price;
import util.province;

import javax.swing.*;

import static java.lang.Double.parseDouble;
import static java.lang.Double.sum;

//序号hao  始发地(省名)origin_address  目的地(省名) destination 包裹称重重量weight  包裹标准重量standard_weight 计费重量bill_weight
public class compute {

    public static double compute_price(String hao,String product_type,String origin_address,String endadress,String destination,String cost_true,int num,double weight){


        if ("上海".equals(origin_address)){
//            System.out.println(origin_address+ " " + destination + " "+ num);

            if (num>=0 && num<1000){
                if (province.jude(destination,endadress,product_type) == 0 ) return parseDouble(cost_true);
                else if (province.jude(destination,endadress,product_type) == 1 ){
                    return(7.8 * price.getFirst(weight) + 2.6 * price.getSecond(weight) + 3.9 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 2 ){
                    return(9.1 * price.getFirst(weight) + 3.9 * price.getSecond(weight) + 5.2 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 3 ){
                    return(11.7 * price.getFirst(weight) + 6.5 * price.getSecond(weight) + 7.8 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 4 ){
                    return(15.6 * price.getFirst(weight) + 10.4 * price.getSecond(weight) + 13 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 5 ){
                    return(20.8 * price.getFirst(weight) + 13 * price.getSecond(weight) + 15.6 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 6 ){
                    if (weight<=1)
                        return(25 * weight) ;
                    else return 25 * 1.00 + (weight-1) * 19;
                }
                else if (province.jude(destination,endadress,product_type) == 7 ){
                    if (weight<=1)
                    return(26 * weight) ;
                    else return 26 * 1.00 + (weight-1) * 21;
                }
                else if (province.jude(destination,endadress,product_type) == 8)
                {
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 11)){
                    if (weight<=1)
                    {
                        return(12 * weight) ;
                    }
                    else return 12 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 12)){
                    if (weight<=1)
                    {
                        return(14 * weight) ;
                    }
                    else return 14 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 13)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 5;
                }
                else if ((province.jude(destination,endadress,product_type) == 14)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 6;
                }
                else if ((province.jude(destination,endadress,product_type) == 15)){
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 16)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 9;
                }

                else if ((province.jude(destination,endadress,product_type) == 17)){
                    if (weight<=1)
                    {
                        return(20 * weight) ;
                    }
                    else return 20 * 1.00 + (weight-1) * 10;
                }
                else {
                    System.out.println("错误地址" +hao +" " + destination + ":" + endadress);
                }

            }
            if (num>=1000 && num<3000){
                if (province.jude(destination,endadress,product_type) == 0 ) return parseDouble(cost_true);
                else if (province.jude(destination,endadress,product_type) == 1 ){
                    return(6 * price.getFirst(weight) + 2 * price.getSecond(weight) + 3 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 2 ){
                    return(7 * price.getFirst(weight) + 3 * price.getSecond(weight) + 4 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 3 ){
                    return(9 * price.getFirst(weight) + 5 * price.getSecond(weight) + 6 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 4 ){
                    return(12 * price.getFirst(weight) + 8 * price.getSecond(weight) + 10 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 5 ){
                    return(16 * price.getFirst(weight) + 10 * price.getSecond(weight) + 12 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 6 ){
                    if (weight<=1)
                        return(25 * weight) ;
                    else return 25 * 1.00 + (weight-1) * 19;
                }
                else if (province.jude(destination,endadress,product_type) == 7 ){
                    if (weight<=1)
                        return(26 * weight) ;
                    else return 26 * 1.00 + (weight-1) * 21;
                }
                else if (province.jude(destination,endadress,product_type) == 8)
                {
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 11)){
                    if (weight<=1)
                    {
                        return(12 * weight) ;
                    }
                    else return 12 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 12)){
                    if (weight<=1)
                    {
                        return(14 * weight) ;
                    }
                    else return 14 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 13)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 5;
                }
                else if ((province.jude(destination,endadress,product_type) == 14)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 6;
                }
                else if ((province.jude(destination,endadress,product_type) == 15)){
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 16)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 9;
                }

                else if ((province.jude(destination,endadress,product_type) == 17)){
                    if (weight<=1)
                    {
                        return(20 * weight) ;
                    }
                    else return 20 * 1.00 + (weight-1) * 10;
                }
                else {
                    System.out.println("错误地址" +hao +" " + destination + ":" + endadress);
                }

            }
            if (num>=3000 && num<8000){

                if (province.jude(destination,endadress,product_type) == 0 ) return parseDouble(cost_true);
                else if (province.jude(destination,endadress,product_type) == 1 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 3 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 2 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 4 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 3 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 6 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 4 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 10 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 5 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 12 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 6 ){
                    if (weight<=1)
                        return(25 * weight) ;
                    else return 25 * 1.00 + (weight-1) * 19;
                }
                else if (province.jude(destination,endadress,product_type) == 7 ){
                    if (weight<=1)
                        return(26 * weight) ;
                    else return 26 * 1.00 + (weight-1) * 21;
                }
                else if (province.jude(destination,endadress,product_type) == 8)
                {
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }

                else if ((province.jude(destination,endadress,product_type) == 11)){
                    if (weight<=1)
                    {
                        return(12 * weight) ;
                    }
                    else return 12 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 12)){
                    if (weight<=1)
                    {
                        return(14 * weight) ;
                    }
                    else return 14 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 13)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 5;
                }
                else if ((province.jude(destination,endadress,product_type) == 14)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 6;
                }
                else if ((province.jude(destination,endadress,product_type) == 15)){
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 16)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 9;
                }

                else if ((province.jude(destination,endadress,product_type) == 17)){
                    if (weight<=1)
                    {
                        return(20 * weight) ;
                    }
                    else return 20 * 1.00 + (weight-1) * 10;
                }

                else {
                    System.out.println("错误地址" +hao +" " + destination + ":" + endadress);
                }
            }
            if (num>=8000){

                if (province.jude(destination,endadress,product_type) == 0 ) return parseDouble(cost_true);
                else if (province.jude(destination,endadress,product_type) == 1 ){
//                    System.out.println("是1");
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 3 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 2 ){
//                    System.out.println("是2");
//                    System.out.println(weight);
//                    System.out.println(price.getSecond(weight));
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 4 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 3 ){
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 6 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 4 ){
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 10 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 5 ){
//                    System.out.println("是5");
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 12 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 6 ){
                    if (weight<=1)
                        return(25 * weight) ;
                    else return 25 * 1.00 + (weight-1) * 19;
                }
                else if (province.jude(destination,endadress,product_type) == 7 ){
                    if (weight<=1)
                        return(26 * weight) ;
                    else return 26 * 1.00 + (weight-1) * 21;
                }else if (province.jude(destination,endadress,product_type) == 8)
                {
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 11)){
                    if (weight<=1)
                    {
                        return(12 * weight) ;
                    }
                    else return 12 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 12)){
                    if (weight<=1)
                    {
                        return(14 * weight) ;
                    }
                    else return 14 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 13)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 5;
                }
                else if ((province.jude(destination,endadress,product_type) == 14)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 6;
                }
                else if ((province.jude(destination,endadress,product_type) == 15)){
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 16)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 9;
                }
                else if ((province.jude(destination,endadress,product_type) == 17)){
                    if (weight<=1)
                    {
                        return(20 * weight) ;
                    }
                    else return 20 * 1.00 + (weight-1) * 10;
                }
                else {
                    System.out.println("错误地址" +hao +" " + destination + ":" + endadress);
                }
            }
        }
        else
            if ("上海".equals(destination))
        {
            System.out.println(hao+" ");
            String change = "";
            change = destination;
            destination = origin_address;
            origin_address = change;
            if (num>=0 && num<1000){
                if (province.jude(destination,endadress,product_type) == 0 ) return parseDouble(cost_true);
                else if (province.jude(destination,endadress,product_type) == 1 ){
                    return(7.8 * price.getFirst(weight) + 2.6 * price.getSecond(weight) + 3.9 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 2 ){
                    return(9.1 * price.getFirst(weight) + 3.9 * price.getSecond(weight) + 5.2 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 3 ){
                    return(11.7 * price.getFirst(weight) + 6.5 * price.getSecond(weight) + 7.8 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 4 ){
                    return(15.6 * price.getFirst(weight) + 10.4 * price.getSecond(weight) + 13 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 5 ){
                    return(20.8 * price.getFirst(weight) + 13 * price.getSecond(weight) + 15.6 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 6 ){
                    if (weight<=1)
                        return(25 * weight) ;
                    else return 25 * 1.00 + (weight-1) * 19;
                }
                else if (province.jude(destination,endadress,product_type) == 7 ){
                    if (weight<=1)
                        return(26 * weight) ;
                    else return 26 * 1.00 + (weight-1) * 21;
                }
                else if (province.jude(destination,endadress,product_type) == 8)
                {
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 11)){
                    if (weight<=1)
                    {
                        return(12 * weight) ;
                    }
                    else return 12 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 12)){
                    if (weight<=1)
                    {
                        return(14 * weight) ;
                    }
                    else return 14 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 13)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 5;
                }
                else if ((province.jude(destination,endadress,product_type) == 14)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 6;
                }
                else if ((province.jude(destination,endadress,product_type) == 15)){
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 16)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 9;
                }

                else if ((province.jude(destination,endadress,product_type) == 17)){
                    if (weight<=1)
                    {
                        return(20 * weight) ;
                    }
                    else return 20 * 1.00 + (weight-1) * 10;
                }
                else {
                    System.out.println("错误地址" +hao +" " + destination + ":" + endadress);
                }

            }
            if (num>=1000 && num<3000){
                if (province.jude(destination,endadress,product_type) == 0 ) return parseDouble(cost_true);
                else if (province.jude(destination,endadress,product_type) == 1 ){
                    return(6 * price.getFirst(weight) + 2 * price.getSecond(weight) + 3 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 2 ){
                    return(7 * price.getFirst(weight) + 3 * price.getSecond(weight) + 4 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 3 ){
                    return(9 * price.getFirst(weight) + 5 * price.getSecond(weight) + 6 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 4 ){
                    return(12 * price.getFirst(weight) + 8 * price.getSecond(weight) + 10 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 5 ){
                    return(16 * price.getFirst(weight) + 10 * price.getSecond(weight) + 12 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 6 ){
                    if (weight<=1)
                        return(25 * weight) ;
                    else return 25 * 1.00 + (weight-1) * 19;
                }
                else if (province.jude(destination,endadress,product_type) == 7 ){
                    if (weight<=1)
                        return(26 * weight) ;
                    else return 26 * 1.00 + (weight-1) * 21;
                }
                else if (province.jude(destination,endadress,product_type) == 8)
                {
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 11)){
                    if (weight<=1)
                    {
                        return(12 * weight) ;
                    }
                    else return 12 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 12)){
                    if (weight<=1)
                    {
                        return(14 * weight) ;
                    }
                    else return 14 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 13)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 5;
                }
                else if ((province.jude(destination,endadress,product_type) == 14)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 6;
                }
                else if ((province.jude(destination,endadress,product_type) == 15)){
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 16)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 9;
                }

                else if ((province.jude(destination,endadress,product_type) == 17)){
                    if (weight<=1)
                    {
                        return(20 * weight) ;
                    }
                    else return 20 * 1.00 + (weight-1) * 10;
                }
                else {
                    System.out.println("错误地址" +hao +" " + destination + ":" + endadress);
                }

            }
            if (num>=3000 && num<8000){

                if (province.jude(destination,endadress,product_type) == 0 ) return parseDouble(cost_true);
                else if (province.jude(destination,endadress,product_type) == 1 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 3 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 2 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 4 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 3 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 6 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 4 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 10 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 5 ){
                    return(5 * price.getFirst(weight) + 1 * price.getSecond(weight) + 12 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 6 ){
                    if (weight<=1)
                        return(25 * weight) ;
                    else return 25 * 1.00 + (weight-1) * 19;
                }
                else if (province.jude(destination,endadress,product_type) == 7 ){
                    if (weight<=1)
                        return(26 * weight) ;
                    else return 26 * 1.00 + (weight-1) * 21;
                }
                else if (province.jude(destination,endadress,product_type) == 8)
                {
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }

                else if ((province.jude(destination,endadress,product_type) == 11)){
                    if (weight<=1)
                    {
                        return(12 * weight) ;
                    }
                    else return 12 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 12)){
                    if (weight<=1)
                    {
                        return(14 * weight) ;
                    }
                    else return 14 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 13)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 5;
                }
                else if ((province.jude(destination,endadress,product_type) == 14)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 6;
                }
                else if ((province.jude(destination,endadress,product_type) == 15)){
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 16)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 9;
                }

                else if ((province.jude(destination,endadress,product_type) == 17)){
                    if (weight<=1)
                    {
                        return(20 * weight) ;
                    }
                    else return 20 * 1.00 + (weight-1) * 10;
                }

                else {
                    System.out.println("错误地址" +hao +" " + destination + ":" + endadress);
                }
            }
            if (num>=8000){

                if (province.jude(destination,endadress,product_type) == 0 ) return parseDouble(cost_true);
                else if (province.jude(destination,endadress,product_type) == 1 ){
//                    System.out.println("是1");
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 3 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 2 ){
//                    System.out.println("是2");
//                    System.out.println(weight);
//                    System.out.println(price.getSecond(weight));
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 4 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 3 ){
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 6 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 4 ){
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 10 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 5 ){
//                    System.out.println("是5");
                    return(4 * price.getFirst(weight) + 1 * price.getSecond(weight) + 12 * price.getend(weight));
                }
                else if (province.jude(destination,endadress,product_type) == 6 ){
                    if (weight<=1)
                        return(25 * weight) ;
                    else return 25 * 1.00 + (weight-1) * 19;
                }
                else if (province.jude(destination,endadress,product_type) == 7 ){
                    if (weight<=1)
                        return(26 * weight) ;
                    else return 26 * 1.00 + (weight-1) * 21;
                }else if (province.jude(destination,endadress,product_type) == 8)
                {
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 11)){
                    if (weight<=1)
                    {
                        return(12 * weight) ;
                    }
                    else return 12 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 12)){
                    if (weight<=1)
                    {
                        return(14 * weight) ;
                    }
                    else return 14 * 1.00 + (weight-1) * 2;
                }
                else if ((province.jude(destination,endadress,product_type) == 13)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 5;
                }
                else if ((province.jude(destination,endadress,product_type) == 14)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 6;
                }
                else if ((province.jude(destination,endadress,product_type) == 15)){
                    if (weight<=1)
                    {
                        return(21 * weight) ;
                    }
                    else return 21 * 1.00 + (weight-1) * 12;
                }
                else if ((province.jude(destination,endadress,product_type) == 16)){
                    if (weight<=1)
                    {
                        return(18 * weight) ;
                    }
                    else return 18 * 1.00 + (weight-1) * 9;
                }
                else if ((province.jude(destination,endadress,product_type) == 17)){
                    if (weight<=1)
                    {
                        return(20 * weight) ;
                    }
                    else return 20 * 1.00 + (weight-1) * 10;
                }
                else {
                    System.out.println("错误地址" +hao +" " + destination + ":" + endadress);
                }
            }
        }
        return parseDouble(cost_true);
    }
    public static double compute_weight(String hao ,String weight,String standard_weight,String bill_weight) {
        double min = 0;
       //判断异常单的情况将差值过大舍去
        try {
                if(parseDouble(standard_weight)/parseDouble(weight)>10 && parseDouble(weight)>0.00){
                    min = parseDouble(bill_weight);
                }
                else {
                    double our =Math.max(parseDouble(weight), parseDouble(standard_weight));
                    if(parseDouble(bill_weight)-our<=1.00)
                    {
                        min = parseDouble(bill_weight);
                    }else {
                        min= Math.min(our,parseDouble(bill_weight));
                    }
                }

        }catch (Exception e ){
            if ("#N/A".equals(weight)){
                    weight = bill_weight;
            }
            if ("#N/A".equals(standard_weight)){
                standard_weight = bill_weight;
            }
            String replace = standard_weight.replace(",", "");
                if(parseDouble(replace)/parseDouble(weight)>10 && parseDouble(weight)>0.00){
                    min = parseDouble(weight);
                }else {
                    double our =Math.max(parseDouble(weight), parseDouble(replace));
                    if(parseDouble(bill_weight)-our<=1.00)
                    {
                        min = parseDouble(bill_weight);
                    }else {
                        min= Math.min(our,parseDouble(bill_weight));
                    }
                }
//            System.out.println("数据有问题 ：" + hao );
        }

        return min;
//        System.out.println("-----------------------------------------------------" + hao);

    }
}



